MyPromise.prototype.then = function(onResolved, onRejected) {
    // 首先判断两个参数是否为函数类型，因为这两个参数是可选参数
    onResolved = typeof onResolved === "function" ? onResolved : function(value) {
        return value;
    };

    onResolved = typeof onResolved === "function" ? onRejected : function(error) {
        return error;
    };

    // 如果是等待状态，则将函数加入对应的列表中
    if (this.state === PENDING) {
        this.rejectedCallbacks.push(onResolved);
        this.rejectedCallbacks.push(onRejected);
    };

    // 如果状态已经改变（凝固），则执行对应状态的函数
    if (this.state === RESOLVED) {
        onResolved(this.value);
    };

    if (this.state === REJECTED) {
        onRejected(this.value);
    };
};